/*
 * Duplicate Detector Copyright (C) 2010 Marco Biscaro <marcobiscaro2112@gmail.com>
 * 
 * This file is part of Duplicate Detector.
 *
 * Duplicate Detector is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Duplicate Detector is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Duplicate Detector.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.googlecode.duplicatedetector.controller;

import javax.swing.JTree;
import javax.swing.event.TreeModelEvent;
import javax.swing.event.TreeModelListener;

/**
 * Expand all nodes of the tree.
 * 
 * @author Marco Biscaro
 */
public class ExpandNodesListener implements TreeModelListener {

	private JTree tree;

	public ExpandNodesListener(JTree tree) {
		this.tree = tree;
	}

	@Override
	public void treeNodesChanged(TreeModelEvent e) {
		// do nothing
	}

	@Override
	public void treeNodesInserted(TreeModelEvent e) {
		// do nothing
	}

	@Override
	public void treeNodesRemoved(TreeModelEvent e) {
		// do nothing
	}

	@Override
	public void treeStructureChanged(TreeModelEvent e) {
		for (int i = 0; i < tree.getRowCount(); i++) {
			tree.expandRow(i);
		}
	}

}
